import axios from 'axios';
import jsCookie from 'js-cookie'

const instance = axios.create({
  baseUrl: '/',
});

// 请求拦截器
instance.interceptors.request.use(config => {

  const token = jsCookie.get('Access-Token');

  if (token) {
    config.headers['Access-Token'] = token;
  }

  return config;
})

// 响应拦截器
instance.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    console.log(`error：${error}`);
  }
);

export default instance;
